package com.climb.ssm.controller;

import com.climb.ssm.service.AccountService;
import com.climb.ssm.util.BeanFactory3;

public class Client {
    public static void main(String[] args) {
        /**原生强耦合方式1*/
//		AccountService as = new AccountServiceImpl();
        /**使用反射2-工厂模式解耦*/
        for (int i = 0; i < 5; i++) {
            /*立即加载的方式在beanfactory获取bean*/
//            AccountService as = (AccountService) BeanFactory.getBean("accountService");
            /*缓存方式去获取bean*/
            AccountService as= BeanFactory3.getBean("accountService",AccountService.class);
            System.out.println(as);
            as.saveAccount();
     /*       new Thread() {
                @Override
                public void run() {
                    System.out.println("我的线程执行了2");
                    for( int i = 0; i<5;i++)
                    {
                        AccountService as2 = (AccountService) BeanFactory.getBean("accountService");
                        System.out.println(as2);
                    }
                }

            }.start();*/


            /**使用ioc3*/


        }
    }
}